Skip to content

Move Kibana with its cluster's version, after every node (S-024-9) - #612

Merged
shipmill-romamo[bot] merged 1 commit into
mainfrom
feat/579-kibana-version-change
Nov 24, 2026
Merged

shipmill-romamo[bot] merged 1 commit into
mainfrom
feat/579-kibana-version-change

Conversation

@shipmill-romamo

Copy link
Copy Markdown
Contributor

Plan

  • Serves: G-1, G-3
  • Files: engine/ansible/roles/cloudfall_kibana/tasks/version.yml (new), engine/ansible/roles/cloudfall_kibana/filter_plugins/kibana_nodes.py (new), engine/ansible/roles/cloudfall_kibana/tasks/main.yml, engine/ansible/roles/cloudfall_kibana/defaults/main.yml, engine/ansible/roles/cloudfall_kibana/meta/argument_specs.yml, engine/ansible/playbooks/services.yml, sdk/src/cloudfall/lifecycle.py, engine/tests/test_s024_9_kibana_version_change.py (new), sdk/tests/test_s024_9_kibana_version_precondition.py (new), engine/tests/test_s024_kibana_role.py, changelog.d/579-kibana-version-change.md
  • Order: (1) the refusal of a Kibana at another version becomes the refusal of one the converge can't move (newer, or another major), as the Elasticsearch role's; (2) whenever the package would change, version.yml reads every node's version (GET /_nodes) and, while one is older than the declared version, reports the refusal and stops before the install (spec 024, Version); (3) services.yml hands the Kibana role the report directory and run_services_playbook passes it for a project with Kibana, so the converge answers PRECONDITION; (4) the held package moves through the pinned install, and the existing restart and wait for "available" cover the saved-object migration; (5) tests, changelog fragment
  • Proof: S-024-9: engine/tests/test_s024_9_kibana_version_change.py runs version.yml for real with ansible-playbook against a stand-in node of a cluster of two (one node old: refused with the report and PRECONDITION; both new: passes with changed=0), and reads the task order of the role and the plays of services.yml; sdk/tests/test_s024_9_kibana_version_precondition.py proves the services converge answers the reported refusal with its code; S-024-4 and S-024-5 stay proved by the existing tests
  • Tests changed: engine/tests/test_s024_kibana_role.py: the task "Refuse a Kibana of another version than the Elasticsearch service's" asserted an older Kibana is refused, which S-024-9 replaces with moving it; the test now names the renamed task and asserts a newer one is refused, and its list of read-only tasks before the install gains the node check

Summary

Builds S-024-9 of spec 024: Kibana follows a change of its cluster's version, after every node.

  • Before the package changes (cloudfall_kibana/tasks/version.yml, included from main.yml when the installed Kibana differs from the declared version, never in check mode): the role reads GET /_nodes?filter_path=nodes.*.name,nodes.*.version from its node as the cloudfall account (no_log), with the node's CA when remoteAccess is declared. A new filter, cloudfall_kibana_older_nodes, names each node older than the declared version and refuses an answer it can't read (no node, a node without a name, a version not of the form 9.2.4). When one is older, the role writes a refused report (service_kibana_node_older, the nodes and versions behind) to the directory the MariaDB and RabbitMQ roles report to, and fails with PRECONDITION service_kibana_node_older: ... before any task changes the host. Kibana's package is left as it is
  • The services converge answers it with PRECONDITION: run_services_playbook now hands the report directory to a project with a Kibana service too, so the refusal reaches the command as its code and message, as the RabbitMQ majority refusal does. cloudfall-engine playbook run services.yml already passes it for every services run
  • The move itself: the package is held, and the pinned install (allow_change_held_packages) moves it to the new version; the hold stays. The restart it notifies starts the new version, and the existing wait for GET /api/status to report available (up to 10 minutes) covers the saved-object migration, followed by the existing check that Kibana reports the declared version
  • Order: Kibana's play in services.yml already runs after every node this run converges (Kibana service: Kibana converged on a node, with its token and keys (S-024-3, S-024-4, S-024-5) #569); the node read also catches a node outside the run (--limit, or a node left behind)
  • Still refused before anything changes: a Kibana newer than the declared version, or of another major, as the Elasticsearch role refuses its node's
  • Idempotence (S-024-4): a converge that finds Kibana at the declared version reads no node and changes nothing

Test notes

  • New: engine/tests/test_s024_9_kibana_version_change.py (17 tests): the filter on several cluster answers and on malformed ones; the include coming right before the install and its condition (a new version and a first install read the nodes, Kibana at the declared version and a dry run do not); the install, hold, restart flush, wait and version check in that order; services.yml handing the role the report directory; a newer or another-major Kibana refused; and version.yml run for real with ansible-playbook -vvv --diff against a stand-in node answering GET /_nodes for h1 and h2 with basic auth: h2 on 9.2.4 stops with PRECONDITION, writes the report naming h2 9.2.4 alone, sends one GET, and the password is in no output; both on 9.2.5 pass with changed=0 and no report
  • New: sdk/tests/test_s024_9_kibana_version_precondition.py (2 tests): a converge of a project with Kibana passes the report directory, and a reported refusal comes back as LifecycleError with code service_kibana_node_older, which the command answers with PRECONDITION
  • specs.py coverage --spec 024 lists tests for S-024-9
  • Ran locally: ruff check ., mypy, ansible-lint engine/ansible (with ANSIBLE_CONFIG=engine/ansible/ansible.cfg, as CI), cloudfall config validate --project config/examples, and pytest on the new files plus engine/tests/test_s024_kibana_role.py, test_s024_kibana_access.py, test_s024_8_kibana_domain.py, test_s024_kibana_render.py, test_role_handlers_load.py, sdk/tests/test_s024_kibana_converge.py, test_s023_rabbitmq_cluster.py, test_s019_mariadb_replication.py. The full suite is left to CI

Unverified live (needs Debian 13 hosts with Elastic's packages):

  • a patch change converging the node and then Kibana on a real host, APT moving the held kibana package, Kibana's saved-object migration finishing within the wait, and the dashboard of S-024-6 opening afterwards
  • the exact shape of Elasticsearch 9's filtered GET /_nodes answer on a real cluster of two with one node on the old version

Fixes #579

🤖 Generated with Claude Code

A change of the Elasticsearch service's version now moves Kibana in the
same converge instead of refusing it. Before Kibana's held package
changes, the role reads every node's version (GET /_nodes) and, while one
is older than the declared version, leaves Kibana as it is and reports
the refusal, which the services converge answers with PRECONDITION
(service_kibana_node_older). Kibana then restarts on the new version and
the converge waits until it reports itself available, its saved objects
migrated. A Kibana at the declared version reads nothing more, so a second
converge stays changed=0.

Fixes #579

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

@shipmill-romamo shipmill-romamo Bot left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verdict: MERGE. No fix commits; reviewed head 8105ce9.

Rebase onto origin/main: no-op, no conflicts; changelog_guard check exits 0.

Checks run locally: ruff, mypy, ansible-lint engine/ansible (CI's ANSIBLE_CONFIG), config validate --project config/examples, pytest on engine/tests and sdk/tests test_s024_* plus test_s023_rabbitmq_cluster.py: 122 passed. Full suite left to CI.

What holds: versions compare numerically (9.2.10 after 9.2.9), malformed or prerelease versions are refused; with one of two nodes old the converge stops before any task changes the host; a Kibana at the declared version and a dry run read no node; the refusal reaches the CLI as PRECONDITION, only for projects with Kibana; the cloudfall password stays out of -vvv output.

Unverified live (stand-ins only): the APT move of the held package, the saved-object migration within the 10-minute wait, the dashboard opening afterwards, a real Elasticsearch 9 GET /_nodes answer.

Findings not fixed (all nits):

  • F-1 filter_plugins/kibana_nodes.py:31: a declared node missing from the GET /_nodes answer is not refused, so Kibana can move ahead of a node that is down. Elasticsearch won't let an older node rejoin a cluster of newer ones, and a run including that node fails anyway. Follow-up: compare against elasticsearch.nodes on a move
  • F-2 tasks/main.yml:146: the comment says every node is read; only the answering ones are
  • F-3 tasks/version.yml:9: a failed node read shows only a no_log result, with no plain hint (same as the existing credentials read)
  • F-4 the guide's version-change section is not written yet (guide arrives with #613, the rest with #582)

History: H-1 consistent, H-3 consistent, H-4 consistent, H-11 unrelated, H-12 no overlapping lines.

@shipmill-romamo
shipmill-romamo Bot merged commit f56ae48 into main Nov 24, 2026
3 checks passed
@shipmill-romamo
shipmill-romamo Bot deleted the feat/579-kibana-version-change branch November 24, 2026 17:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Kibana service: following the cluster's version change (S-024-9)

0 participants